home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / dos / adddosentry.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  2.6 KB  |  111 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: adddosentry.c,v 1.8 1997/01/27 00:36:13 ldp Exp $
  4.     $Log: adddosentry.c,v $
  5.     Revision 1.8  1997/01/27 00:36:13  ldp
  6.     Polish
  7.  
  8.     Revision 1.7  1996/12/09 13:53:20  aros
  9.     Added empty templates for all missing functions
  10.  
  11.     Moved #include's into first column
  12.  
  13.     Revision 1.6  1996/11/14 08:54:17  aros
  14.     Some more changes
  15.  
  16.     Revision 1.5  1996/10/24 15:50:23  aros
  17.     Use the official AROS macros over the __AROS versions.
  18.  
  19.     Revision 1.4  1996/10/10 13:18:38  digulla
  20.     Use dl_DevNam instaed of dl_Name (STRPTR and BPTR) (Fleischer)
  21.  
  22.     Revision 1.3  1996/08/13 13:52:44  digulla
  23.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  24.     Replaced AROS_LA by AROS_LHA
  25.  
  26.     Revision 1.2  1996/08/01 17:40:47  digulla
  27.     Added standard header for all files
  28.  
  29.     Desc:
  30.     Lang: english
  31. */
  32. #include <dos/dosextens.h>
  33. #include <proto/utility.h>
  34. #include "dos_intern.h"
  35.  
  36. /*****************************************************************************
  37.  
  38.     NAME */
  39. #include <proto/dos.h>
  40.  
  41.     AROS_LH1(LONG, AddDosEntry,
  42.  
  43. /*  SYNOPSIS */
  44.     AROS_LHA(struct DosList *, dlist, D1),
  45.  
  46. /*  LOCATION */
  47.     struct DosLibrary *, DOSBase, 113, Dos)
  48.  
  49. /*  FUNCTION
  50.     Adds a given dos list entry to the dos list. Automatically
  51.     locks the list for writing. There may be not more than one device
  52.     or assign node of the same name. There are no restrictions on
  53.     volume nodes.
  54.  
  55.     INPUTS
  56.     dlist - pointer to dos list entry.
  57.  
  58.     RESULT
  59.     !=0 if all went well, 0 otherwise.
  60.  
  61.     NOTES
  62.     Since anybody who wants to use a device or volume node in the
  63.     dos list has to lock the list, filesystems may be called with
  64.     the dos list locked. So if you want to add a dos list entry
  65.     out of a filesystem don't just wait on the lock but serve all
  66.     incoming requests until the dos list is free instead.
  67.  
  68.     EXAMPLE
  69.  
  70.     BUGS
  71.  
  72.     SEE ALSO
  73.  
  74.     INTERNALS
  75.  
  76.     HISTORY
  77.     29-10-95    digulla automatically created from
  78.                 dos_lib.fd and clib/dos_protos.h
  79.  
  80. *****************************************************************************/
  81. {
  82.     AROS_LIBFUNC_INIT
  83.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  84.     LONG success=1;
  85.     struct DosList *dl;
  86.  
  87.     dl=LockDosList(LDF_ALL|LDF_WRITE);
  88.     if(dlist->dol_Type!=DLT_VOLUME)
  89.     for(;;)
  90.     {
  91.         dl=dl->dol_Next;
  92.         if(dl==NULL)
  93.         break;
  94.         if(dl->dol_Type!=DLT_VOLUME&&
  95.            !Stricmp(dl->dol_DevName,dlist->dol_DevName))
  96.         {
  97.         success=0;
  98.         break;
  99.         }
  100.     }
  101.     if(success)
  102.     {
  103.     dlist->dol_Next=DOSBase->dl_DevInfo;
  104.     DOSBase->dl_DevInfo=dlist;
  105.     }
  106.     UnLockDosList(LDF_ALL|LDF_WRITE);
  107.  
  108.     return success;    
  109.     AROS_LIBFUNC_EXIT
  110. } /* AddDosEntry */
  111.