From f193250f9694b1cfb73529ed55dbe074020d1107 Mon Sep 17 00:00:00 2001 From: adilger Date: Mon, 3 Jun 2002 22:36:53 +0000 Subject: [PATCH] Move ioctl values out of the way of standard ext2/ext3 ioctl numbers. --- lustre/include/linux/lustre_idl.h | 64 +++++++++++++++++++-------------------- lustre/obdclass/class_obd.c | 53 ++++++++++++++++---------------- lustre/ptlrpc/rpc.c | 2 +- lustre/tests/test.c | 7 +---- lustre/utils/obdctl.c | 18 +++++------ 5 files changed, 69 insertions(+), 75 deletions(-) diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index d517c34..66dbfea 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -534,37 +534,37 @@ static inline int obd_ioctl_getdata(char *buf, char *end, void *arg) #endif -#define OBD_IOC_CREATE _IOR ('f', 3, long) -#define OBD_IOC_SETUP _IOW ('f', 4, long) -#define OBD_IOC_CLEANUP _IO ('f', 5 ) -#define OBD_IOC_DESTROY _IOW ('f', 6, long) -#define OBD_IOC_PREALLOCATE _IOWR('f', 7, long) -#define OBD_IOC_DEC_USE_COUNT _IO ('f', 8 ) -#define OBD_IOC_SETATTR _IOW ('f', 9, long) -#define OBD_IOC_GETATTR _IOR ('f', 10, long) -#define OBD_IOC_READ _IOWR('f', 11, long) -#define OBD_IOC_WRITE _IOWR('f', 12, long) -#define OBD_IOC_CONNECT _IOR ('f', 13, long) -#define OBD_IOC_DISCONNECT _IOW ('f', 14, long) -#define OBD_IOC_STATFS _IOWR('f', 15, long) -#define OBD_IOC_SYNC _IOR ('f', 16, long) -#define OBD_IOC_READ2 _IOWR('f', 17, long) -#define OBD_IOC_FORMAT _IOWR('f', 18, long) -#define OBD_IOC_PARTITION _IOWR('f', 19, long) -#define OBD_IOC_ATTACH _IOWR('f', 20, long) -#define OBD_IOC_DETACH _IOWR('f', 21, long) -#define OBD_IOC_COPY _IOWR('f', 22, long) -#define OBD_IOC_MIGR _IOWR('f', 23, long) -#define OBD_IOC_PUNCH _IOWR('f', 24, long) -#define OBD_IOC_DEVICE _IOWR('f', 25, long) -#define OBD_IOC_MODULE_DEBUG _IOWR('f', 26, long) -#define OBD_IOC_BRW_READ _IOWR('f', 27, long) -#define OBD_IOC_BRW_WRITE _IOWR('f', 28, long) -#define OBD_IOC_NAME2DEV _IOWR('f', 29, long) -#define OBD_IOC_NEWDEV _IOWR('f', 30, long) - -#define OBD_RECOVD_NEWCONN _IOWR('f', 31, long) - -#define OBD_IOC_DEC_FS_USE_COUNT _IO ('f', 32 ) +#define OBD_IOC_CREATE _IOR ('f', 101, long) +#define OBD_IOC_SETUP _IOW ('f', 102, long) +#define OBD_IOC_CLEANUP _IO ('f', 103 ) +#define OBD_IOC_DESTROY _IOW ('f', 104, long) +#define OBD_IOC_PREALLOCATE _IOWR('f', 105, long) +#define OBD_IOC_DEC_USE_COUNT _IO ('f', 106 ) +#define OBD_IOC_SETATTR _IOW ('f', 107, long) +#define OBD_IOC_GETATTR _IOR ('f', 108, long) +#define OBD_IOC_READ _IOWR('f', 109, long) +#define OBD_IOC_WRITE _IOWR('f', 110, long) +#define OBD_IOC_CONNECT _IOR ('f', 111, long) +#define OBD_IOC_DISCONNECT _IOW ('f', 112, long) +#define OBD_IOC_STATFS _IOWR('f', 113, long) +#define OBD_IOC_SYNC _IOR ('f', 114, long) +#define OBD_IOC_READ2 _IOWR('f', 115, long) +#define OBD_IOC_FORMAT _IOWR('f', 116, long) +#define OBD_IOC_PARTITION _IOWR('f', 117, long) +#define OBD_IOC_ATTACH _IOWR('f', 118, long) +#define OBD_IOC_DETACH _IOWR('f', 119, long) +#define OBD_IOC_COPY _IOWR('f', 120, long) +#define OBD_IOC_MIGR _IOWR('f', 121, long) +#define OBD_IOC_PUNCH _IOWR('f', 122, long) +#define OBD_IOC_DEVICE _IOWR('f', 123, long) +#define OBD_IOC_MODULE_DEBUG _IOWR('f', 124, long) +#define OBD_IOC_BRW_READ _IOWR('f', 125, long) +#define OBD_IOC_BRW_WRITE _IOWR('f', 126, long) +#define OBD_IOC_NAME2DEV _IOWR('f', 127, long) +#define OBD_IOC_NEWDEV _IOWR('f', 128, long) + +#define OBD_IOC_RECOVD_NEWCONN _IOWR('f', 131, long) + +#define OBD_IOC_DEC_FS_USE_COUNT _IO ('f', 132 ) #endif diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 62d14ea..23f59faf 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -9,10 +9,10 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. - * + * * Adapted to become the Linux 2.0 Coda pseudo device - * Peter Braam - * Michael Callahan + * Peter Braam + * Michael Callahan * * Changes for Linux 2.1 * Copyright (c) 1997 Carnegie-Mellon University @@ -26,7 +26,7 @@ * Copyright (C) 1999 Seagate Technology, Inc. * Copyright (C) 2001 Cluster File Systems, Inc. * - * + * */ #define EXPORT_SYMTAB @@ -103,8 +103,8 @@ static int obd_class_name2dev(char *name) return res; } -/* - * support functions: we could use inter-module communication, but this +/* + * support functions: we could use inter-module communication, but this * is more portable to other OS's */ static struct obd_type *obd_search_type(char *nm) @@ -112,7 +112,7 @@ static struct obd_type *obd_search_type(char *nm) struct list_head *tmp; struct obd_type *type; CDEBUG(D_INFO, "SEARCH %s\n", nm); - + tmp = &obd_types; while ( (tmp = tmp->next) != &obd_types ) { type = list_entry(tmp, struct obd_type, typ_chain); @@ -125,7 +125,7 @@ static struct obd_type *obd_search_type(char *nm) return NULL; } -static struct obd_type *obd_nm_to_type(char *nm) +static struct obd_type *obd_nm_to_type(char *nm) { struct obd_type *type = obd_search_type(nm); @@ -143,7 +143,7 @@ static struct obd_type *obd_nm_to_type(char *nm) } /* to control /dev/obd */ -static int obd_class_ioctl (struct inode * inode, struct file * filp, +static int obd_class_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned long arg) { /* NOTE this must be larger than any of the ioctl data structs */ @@ -157,8 +157,8 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, memset(buf, 0, sizeof(buf)); - if (!obd && cmd != OBD_IOC_DEVICE && cmd != TCGETS - && cmd != OBD_IOC_NAME2DEV && cmd != OBD_IOC_NEWDEV) { + if (!obd && cmd != OBD_IOC_DEVICE && cmd != TCGETS && + cmd != OBD_IOC_NAME2DEV && cmd != OBD_IOC_NEWDEV) { CERROR("OBD ioctl: No device\n"); RETURN(-EINVAL); } @@ -212,19 +212,19 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, int i; filp->private_data = NULL; - for (i = 0 ; i < MAX_OBD_DEVICES ; i++) { + for (i = 0 ; i < MAX_OBD_DEVICES ; i++) { struct obd_device *obd = &obd_dev[i]; - if (!obd->obd_type) { + if (!obd->obd_type) { filp->private_data = obd; dev = i; break; } } - - data->ioc_dev = dev; - if (dev == -1) - RETURN(-EINVAL); + + data->ioc_dev = dev; + if (dev == -1) + RETURN(-EINVAL); err = copy_to_user((int *)arg, data, sizeof(*data)); RETURN(err); @@ -336,7 +336,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, if ( OBT(obd) && OBP(obd, setup) ) err = obd_setup(obd, sizeof(*data), data); - if (!err) { + if (!err) { obd->obd_type->typ_refcnt++; obd->obd_flags |= OBD_SET_UP; } @@ -362,7 +362,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, case OBD_IOC_CONNECT: { conn.oc_id = data->ioc_conn1; - conn.oc_dev = obd; + conn.oc_dev = obd; err = obd_connect(&conn); @@ -375,15 +375,15 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp, RETURN(err); } - case OBD_IOC_DISCONNECT: { + case OBD_IOC_DISCONNECT: { conn.oc_id = data->ioc_conn1; conn.oc_dev = obd; err = obd_disconnect(&conn); RETURN(err); - } + } - case OBD_IOC_DEC_USE_COUNT: { + case OBD_IOC_DEC_USE_COUNT: { MOD_DEC_USE_COUNT; RETURN(0); } @@ -614,7 +614,7 @@ EXPORT_SYMBOL(gen_connect); EXPORT_SYMBOL(gen_client); EXPORT_SYMBOL(gen_cleanup); EXPORT_SYMBOL(gen_disconnect); -EXPORT_SYMBOL(gen_copy_data); +EXPORT_SYMBOL(gen_copy_data); EXPORT_SYMBOL(obdo_cachep); /* EXPORT_SYMBOL(gen_multi_attach); */ @@ -661,9 +661,8 @@ static void __exit cleanup_obdclass(void) misc_deregister(&obd_psdev); for (i = 0; i < MAX_OBD_DEVICES; i++) { struct obd_device *obd = &obd_dev[i]; - if ( obd->obd_type && - (obd->obd_flags & OBD_SET_UP) && - OBT(obd) && OBP(obd, detach) ) { + if (obd->obd_type && (obd->obd_flags & OBD_SET_UP) && + OBT(obd) && OBP(obd, detach)) { /* XXX should this call generic detach otherwise? */ OBP(obd, detach)(obd); } @@ -678,7 +677,7 @@ static void __exit cleanup_obdclass(void) MODULE_AUTHOR("Cluster File Systems, Inc. "); MODULE_DESCRIPTION("Lustre Class Driver v1.0"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL"); module_init(init_obdclass); module_exit(cleanup_obdclass); diff --git a/lustre/ptlrpc/rpc.c b/lustre/ptlrpc/rpc.c index 1ea5145..861938d 100644 --- a/lustre/ptlrpc/rpc.c +++ b/lustre/ptlrpc/rpc.c @@ -107,7 +107,7 @@ int connmgr_iocontrol(long cmd, struct obd_conn *conn, int len, void *karg, struct recovd_obd *recovd = &conn->oc_dev->u.recovd; ENTRY; - if (cmd == OBD_RECOVD_NEWCONN) { + if (cmd == OBD_IOC_RECOVD_NEWCONN) { spin_lock(&recovd->recovd_lock); recovd->recovd_flags |= RECOVD_UPCALL_ANSWER; recovd->recovd_wakeup_flag = 1; diff --git a/lustre/tests/test.c b/lustre/tests/test.c index b941d78..d4c6bf7 100755 --- a/lustre/tests/test.c +++ b/lustre/tests/test.c @@ -13,12 +13,7 @@ #include #include #include - -#define OBD_IOC_CREATE _IOR('f', 3, long) -#define OBD_IOC_SETUP _IOW('f', 4, long) -#define OBD_IOC_SYNC _IOR('f', 16, long) -#define OBD_IOC_DESTROY _IOW('f', 6, long) -#define OBD_IOC_STATFS _IORW('f', 15, long) +#include #define LOOP_DEVICE "/dev/loop0" #define OBD_DEVICE "/dev/obd" diff --git a/lustre/utils/obdctl.c b/lustre/utils/obdctl.c index 712e420..33202dd 100644 --- a/lustre/utils/obdctl.c +++ b/lustre/utils/obdctl.c @@ -506,16 +506,16 @@ static int jt_attach(int argc, char **argv) if (rc < 0) fprintf(stderr, "error: %s: %x %s\n", cmdname(argv[0]), OBD_IOC_ATTACH, strerror(rc = errno)); - else if (argc == 3) { + else if (argc == 3) { char name[1024]; - if (strlen(argv[2]) > 128) { + if (strlen(argv[2]) > 128) { printf("Name too long to set environment\n"); return -EINVAL; } snprintf(name, 512, "LUSTRE_DEV_%s", argv[2]); - rc = setenv(name, argv[1], 1); - if (rc) { - printf("error setting env variable %s\n", name); + rc = setenv(name, argv[1], 1); + if (rc) { + printf("error setting env variable %s\n", name); } } @@ -673,7 +673,7 @@ static int jt_setattr(int argc, char **argv) data.ioc_obdo1.o_id = strtoul(argv[1], NULL, 0); data.ioc_obdo1.o_mode = S_IFREG | strtoul(argv[2], NULL, 0); - data.ioc_obdo1.o_valid = OBD_MD_FLMODE; + data.ioc_obdo1.o_valid = OBD_MD_FLMODE; rc = ioctl(fd, OBD_IOC_SETATTR , &data); if (rc < 0) @@ -717,7 +717,7 @@ static int jt_getattr(int argc, char **argv) IOCINIT(data); data.ioc_obdo1.o_id = strtoul(argv[1], NULL, 0); - /* to help obd filter */ + /* to help obd filter */ data.ioc_obdo1.o_mode = 0100644; data.ioc_obdo1.o_valid = 0xffffffff; printf("%s: object id %Ld\n", cmdname(argv[0]), data.ioc_obdo1.o_id); @@ -936,7 +936,7 @@ static int jt_newconn(int argc, char **argv) return -1; } - rc = ioctl(fd, OBD_RECOVD_NEWCONN , &data); + rc = ioctl(fd, OBD_IOC_RECOVD_NEWCONN , &data); if (rc < 0) fprintf(stderr, "error: %s: %s\n", cmdname(argv[0]), strerror(rc = errno)); @@ -984,7 +984,7 @@ command_t cmdlist[] = { static void signal_server(int sig) { - if (sig == SIGINT) { + if (sig == SIGINT) { do_disconnect("sigint", 1); exit(1); } else { -- 1.8.3.1