filehandles.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2011-2012 Nokia Corporation and/or its subsidiary(-ies).
  3. * All rights reserved.
  4. * This component and the accompanying materials are made available
  5. * under the terms of the License "Eclipse Public License v1.0"
  6. * which accompanies this distribution, and is available
  7. * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  8. *
  9. * Initial Contributors:
  10. * Nokia Corporation - initial contribution.
  11. *
  12. * Contributors:
  13. *
  14. * Description:
  15. *
  16. * Mapping between "our" handles and real OS filehandles.
  17. */
  18. #ifndef _FILEHANDLES_H_
  19. #define _FILEHANDLES_H_
  20. #include <sys/param.h>
  21. typedef struct {
  22. int opencount;
  23. int realfh;
  24. char name[MAXPATHLEN];
  25. } caseless_filehandle;
  26. #define FHTABLE_SIZE 1000
  27. void fhtable_init(void); /* Initialise filehandle map */
  28. int fh_new(int realfh); /* allocate one of "our" handles given a real one */
  29. int fh_close(int fh); /* unmap one of "our" handles */
  30. int fh_getreal(int fh); /* lookup a real handle using "our" handle */
  31. int fh_find(int realfh); /* reverse lookup from a real filehandle to "our" equivalent */
  32. extern caseless_filehandle fhtable[FHTABLE_SIZE];
  33. #define FH_ACCESS(fh) fhtable[fh]
  34. #endif