summaryrefslogtreecommitdiffstats
path: root/sys/sys/conf.h
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2008-06-12 08:30:54 +0000
committered <ed@FreeBSD.org>2008-06-12 08:30:54 +0000
commit4327eebef0393f0b9c18ab3f86b4555ef309f742 (patch)
treef8f066a50f4fd515a22bc25b1b4119448ab6f55b /sys/sys/conf.h
parent1053568d9da027edf9d7e40fef69b0fe630965ff (diff)
downloadFreeBSD-src-4327eebef0393f0b9c18ab3f86b4555ef309f742.zip
FreeBSD-src-4327eebef0393f0b9c18ab3f86b4555ef309f742.tar.gz
Turn dev2unit(), minor(), unit2minor() and minor2unit() into macro's.
Now that we got rid of the minor-to-unit conversion and the constraints on device minor numbers, we can convert the functions that operate on minor and unit numbers to simple macro's. The unit2minor() and minor2unit() macro's are now no-ops. The ZFS code als defined a macro named `minor'. Change the ZFS code to use umajor() and uminor() here, as it is the correct approach to do this. Also add $FreeBSD$ to keep SVN happy. Approved by: philip (mentor), pjd
Diffstat (limited to 'sys/sys/conf.h')
-rw-r--r--sys/sys/conf.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index e26b721..cd2bb8d 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -273,13 +273,15 @@ struct cdev *make_dev_credf(int _flags,
struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode,
const char *_fmt, ...) __printflike(8, 9);
struct cdev *make_dev_alias(struct cdev *_pdev, const char *_fmt, ...) __printflike(2, 3);
-int dev2unit(struct cdev *_dev);
void dev_lock(void);
void dev_unlock(void);
-int unit2minor(int _unit);
-u_int minor2unit(u_int _minor);
void setconf(void);
+#define dev2unit(d) ((d) ? (d)->si_drv0 : NODEV)
+#define minor(d) ((d) ? (d)->si_drv0 : NODEV)
+#define unit2minor(u) (u)
+#define minor2unit(m) (m)
+
typedef void (*cdevpriv_dtr_t)(void *data);
int devfs_get_cdevpriv(void **datap);
int devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr);
OpenPOWER on IntegriCloud