From b9090a0074f44d786dea2bd222dacb321a3603e3 Mon Sep 17 00:00:00 2001 From: lsy Date: Sat, 7 Oct 2006 15:26:59 +0000 Subject: [PATCH] remove \n from parameter strings, otherwise it will confuse later pattern match. also rename rootsquash_skips to nosquash_nids. --- lustre/mdt/mdt_lproc.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index 6a7b27e..df102ee 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -438,7 +438,7 @@ static int lprocfs_wr_rootsquash_gid(struct file *file, const char *buffer, return count; } -static int lprocfs_rd_rootsquash_skips(char *page, char **start, off_t off, +static int lprocfs_rd_nosquash_nids(char *page, char **start, off_t off, int count, int *eof, void *data) { struct obd_device *obd = data; @@ -456,6 +456,14 @@ static int lprocfs_rd_rootsquash_skips(char *page, char **start, off_t off, return ret; } +static inline void remove_newline(char *str) +{ + int len = strlen(str); + + if (str[len - 1] == '\n') + str[len - 1] = '\0'; +} + /* FIXME: this macro is copied from lnet/libcfs/nidstring.c */ #define LNET_NIDSTR_SIZE 32 /* size of each one (see below for usage) */ static void do_process_nosquash_nids(struct mdt_device *m, char *buf) @@ -489,7 +497,7 @@ ignore: } } -static int lprocfs_wr_rootsquash_skips(struct file *file, const char *buffer, +static int lprocfs_wr_nosquash_nids(struct file *file, const char *buffer, unsigned long count, void *data) { struct obd_device *obd = data; @@ -510,6 +518,7 @@ static int lprocfs_wr_rootsquash_skips(struct file *file, const char *buffer, if (!mdt->mdt_rootsquash_info) RETURN(-ENOMEM); + remove_newline(skips); do_process_nosquash_nids(mdt, skips); return count; } @@ -636,8 +645,8 @@ static struct lprocfs_vars lprocfs_mdt_obd_vars[] = { lprocfs_wr_rootsquash_uid, 0 }, { "rootsquash_gid", lprocfs_rd_rootsquash_gid, lprocfs_wr_rootsquash_gid, 0 }, - { "rootsquash_skips", lprocfs_rd_rootsquash_skips, - lprocfs_wr_rootsquash_skips, 0 }, + { "nosquash_nids", lprocfs_rd_nosquash_nids, + lprocfs_wr_nosquash_nids, 0 }, { "capa", lprocfs_rd_capa, lprocfs_wr_capa, 0 }, { "capa_timeout", lprocfs_rd_capa_timeout, -- 1.8.3.1