mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-24 18:54:52 +00:00
Make devfs_add_devfsf() which takes printf style args.
This commit is contained in:
parent
f782b11a04
commit
831e28a67a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13629
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
* Written by Julian Elischer (julian@DIALix.oz.au)
|
||||
*
|
||||
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.14 1996/01/21 09:07:58 julian Exp $
|
||||
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.15 1996/01/21 09:43:31 julian Exp $
|
||||
*/
|
||||
|
||||
#include "param.h"
|
||||
|
@ -892,6 +892,43 @@ int dev_add_entry(char *name, dn_p parent, int type, union typeinfo *by, devnm_p
|
|||
return error;
|
||||
}
|
||||
|
||||
/***********************************************************************\
|
||||
* Add the named device entry into the given directory, and make it *
|
||||
* The appropriate type... (called (sometimes indirectly) by drivers..) *
|
||||
* this function is exported.. see sys/devfsext.h *
|
||||
\***********************************************************************/
|
||||
void *devfs_add_devswf(
|
||||
void *devsw,
|
||||
int minor,
|
||||
int chrblk,
|
||||
uid_t uid,
|
||||
gid_t gid,
|
||||
int perms,
|
||||
char *fmt,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
char *p, buf[256]; /* XXX */
|
||||
int i;
|
||||
|
||||
va_start(ap, fmt);
|
||||
i = kvprintf(fmt, NULL, (void*)buf, 32, ap);
|
||||
va_end(ap);
|
||||
buf[i] = '\0';
|
||||
p = NULL;
|
||||
for (i=0; buf[i]; i++)
|
||||
if (buf[i] == '/')
|
||||
p = buf + 1;
|
||||
if (p) {
|
||||
*p++ = '\0';
|
||||
return devfs_add_devsw(buf, p, devsw, minor, chrblk,
|
||||
uid, gid, perms);
|
||||
} else {
|
||||
return devfs_add_devsw("/", buf, devsw, minor, chrblk,
|
||||
uid, gid, perms);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************\
|
||||
* Add the named device entry into the given directory, and make it *
|
||||
* The appropriate type... (called (sometimes indirectly) by drivers..) *
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* usual BSD style copyright here */
|
||||
/* Written by Julian Elischer (julian@dialix.oz.au)*/
|
||||
/*
|
||||
* $Id: devfsext.h,v 1.5 1995/12/09 09:11:25 julian Exp $
|
||||
* $Id: devfsext.h,v 1.6 1996/01/21 09:03:04 julian Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DEVFSECT_H_
|
||||
|
@ -15,6 +15,15 @@ void *devfs_add_devsw(char *path,
|
|||
gid_t gid,
|
||||
int perms) ;
|
||||
|
||||
void *devfs_add_devswf(void *devsw,
|
||||
int minor,
|
||||
int chrblk,
|
||||
uid_t uid,
|
||||
gid_t gid,
|
||||
int perms,
|
||||
char *fmt,
|
||||
...) ;
|
||||
|
||||
void *dev_link(char *path,
|
||||
char *name,
|
||||
void *original); /* the result of a previous dev_link
|
||||
|
|
Loading…
Reference in a new issue