attribute.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * linux/fs/befs/attribute.c
  3. *
  4. * Copyright (C) 2002 Will Dyson <will_dyson@pobox.com>
  5. *
  6. * Many thanks to Dominic Giampaolo, author of "Practical File System
  7. * Design with the Be File System", for such a helpful book.
  8. *
  9. */
  10. #include <linux/fs.h>
  11. #include <linux/kernel.h>
  12. #include <linux/string.h>
  13. #include "befs.h"
  14. #include "endian.h"
  15. #define SD_DATA(sd)\
  16. (void*)((char*)sd + sizeof(*sd) + (sd->name_size - sizeof(sd->name)))
  17. #define SD_NEXT(sd)\
  18. (befs_small_data*)((char*)sd + sizeof(*sd) + (sd->name_size - \
  19. sizeof(sd->name) + sd->data_size))
  20. int
  21. list_small_data(struct super_block *sb, befs_inode * inode, filldir_t filldir);
  22. befs_small_data *
  23. find_small_data(struct super_block *sb, befs_inode * inode,
  24. const char *name);
  25. int
  26. read_small_data(struct super_block *sb, befs_inode * inode,
  27. befs_small_data * sdata, void *buf, size_t bufsize);
  28. /**
  29. *
  30. *
  31. *
  32. *
  33. *
  34. */
  35. befs_small_data *
  36. find_small_data(struct super_block *sb, befs_inode * inode, const char *name)
  37. {
  38. befs_small_data *sdata = inode->small_data;
  39. while (sdata->type != 0) {
  40. if (strcmp(name, sdata->name) != 0) {
  41. return sdata;
  42. }
  43. sdata = SD_NEXT(sdata);
  44. }
  45. return NULL;
  46. }
  47. /**
  48. *
  49. *
  50. *
  51. *
  52. *
  53. */
  54. int
  55. read_small_data(struct super_block *sb, befs_inode * inode,
  56. const char *name, void *buf, size_t bufsize)
  57. {
  58. befs_small_data *sdata;
  59. sdata = find_small_data(sb, inode, name);
  60. if (sdata == NULL)
  61. return BEFS_ERR;
  62. else if (sdata->data_size > bufsize)
  63. return BEFS_ERR;
  64. memcpy(buf, SD_DATA(sdata), sdata->data_size);
  65. return BEFS_OK;
  66. }
  67. /**
  68. *
  69. *
  70. *
  71. *
  72. *
  73. */
  74. int
  75. list_small_data(struct super_block *sb, befs_inode * inode)
  76. {
  77. }
  78. /**
  79. *
  80. *
  81. *
  82. *
  83. *
  84. */
  85. int
  86. list_attr(struct super_block *sb, befs_inode * inode)
  87. {
  88. }
  89. /**
  90. *
  91. *
  92. *
  93. *
  94. *
  95. */
  96. int
  97. read_attr(struct super_block *sb, befs_inode * inode)
  98. {
  99. }