getprop.c 803 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (C) Paul Mackerras 1997.
  3. * Copyright (C) Leigh Brown 2002.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version
  8. * 2 of the License, or (at your option) any later version.
  9. */
  10. #include "of1275.h"
  11. int
  12. getprop(phandle node, const char *name, void *buf, int buflen)
  13. {
  14. struct prom_args {
  15. char *service;
  16. int nargs;
  17. int nret;
  18. phandle node;
  19. const char *name;
  20. void *buf;
  21. int buflen;
  22. int size;
  23. } args;
  24. args.service = "getprop";
  25. args.nargs = 4;
  26. args.nret = 1;
  27. args.node = node;
  28. args.name = name;
  29. args.buf = buf;
  30. args.buflen = buflen;
  31. args.size = -1;
  32. (*of_prom_entry)(&args);
  33. return args.size;
  34. }