Added kernel module for starting the usb stack at boot time. It's not activated thoug...
[cake.git] / rom / dos / createdir.c
blobf48fa1c701c1fb3b5a1c6d39041ca80f01a1380d
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Create a new directory.
6 Lang: English
7 */
9 #include <exec/memory.h>
10 #include <proto/exec.h>
11 #include <utility/tagitem.h>
12 #include <dos/dos.h>
13 #include <dos/filesystem.h>
14 #include <proto/dos.h>
15 #include <proto/utility.h>
16 #include "dos_intern.h"
18 /*****************************************************************************
20 NAME */
21 #include <proto/dos.h>
23 AROS_LH1(BPTR, CreateDir,
25 /* SYNOPSIS */
26 AROS_LHA(CONST_STRPTR, name, D1),
28 /* LOCATION */
29 struct DosLibrary *, DOSBase, 20, Dos)
31 /* FUNCTION
32 Creates a new directory under the given name. If all went well, an
33 exclusive lock on the new diretory is returned.
35 INPUTS
36 name -- NUL terminated name.
38 RESULT
39 Exclusive lock to the new directory or 0 if it couldn't be created.
40 IoErr() gives additional information in that case.
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
50 INTERNALS
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct FileHandle *fh;
57 struct IOFileSys iofs;
59 if ((fh = (struct FileHandle *) AllocDosObject(DOS_FILEHANDLE, NULL)) == NULL)
60 return NULL;
62 InitIOFS(&iofs, FSA_CREATE_DIR, DOSBase);
63 iofs.io_Union.io_CREATE_DIR.io_Protection = 0;
65 if (DoIOFS(&iofs, NULL, name, DOSBase) != 0) {
66 FreeDosObject(DOS_FILEHANDLE, fh);
67 return NULL;
70 fh->fh_Device = iofs.IOFS.io_Device;
71 fh->fh_Unit = iofs.IOFS.io_Unit;
73 return MKBADDR(fh);
75 AROS_LIBFUNC_EXIT
76 } /* CreateDir */