Plan 9 from Bell Labs’s /usr/web/sources/contrib/de0u/root/sys/src/cmd/divergefs/allrule.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



#include <u.h>
#include <libc.h>
#include <String.h>
#include "common.h"
#include "debug.h"
#include "rule.h"
#include "allrule.h"

enum { DEBUG_ALLRULE = false };

typedef struct AllRule
{
  Rule;
} AllRule;

static RuleOperations allruleops =
{
  .free       = rule_free_self,
  .issatisfy  = rule_issatisfy_true,
  .contains   = rule_contains_true
};

Rule *allrule_new(char *root)
{
  AllRule *result;
  assert_valid(root);

  result = (AllRule *)emalloc_fs(sizeof(*result));
  result->ops = &allruleops;
  result->root = estrdup_fs(root);
  result->name = "all";
  return (Rule *)result;
}

Rule *allrule_parse(char *rule, char *setting, char *path)
{
  assert_valid(rule);
  assert_valid(setting);
  assert_valid(path);

  if(strcmp(rule, "all") != 0)
  {
    return nil;
  }

  INFO(DEBUG_ALLRULE, "parsed all rule with path: %s", path);
  return allrule_new(path);
}



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].